{include file="public/headerbase" /}
{include file="public/left" /}
<div class="right-content">
<ul class="we7-page-tab">
	<li class="active">品牌展示</li>
</ul>
<div class="clearfix">
	<form action="" method="get" class="we7-form" role="form">
	<div class="input-group pull-left col-sm-4">
		<input type="text" name="bname" id="bname" value="" class="form-control" placeholder="搜索品牌名称"/>
		<span class="input-group-btn"><button class="btn btn-default" onclick="sear()"><i class="fa fa-search">搜索</i></button></span>
	</div>
		<div class="form-group">
			<div class="pull-right">
				<a href="{:url('Brand/addlist')}" class="btn btn-primary">添加品牌</a>
			</div>
		</div>
	</form>
	<table class="table we7-table table-hover">
		<col width="150px"/>
		<col width="150px"/>
		<col width="150px"/>
		<col width="150px"/>
		<col width="150px"/>
		<tr>
			<th>排序</th>
			<th>品牌名称</th>
			<th>商品数量</th>
			<th>添加时间</th>
			<th>操作</th>
		</tr>
		{foreach name="brand" item="val"}
		<tr>
			<th><span>{$val.bid}</span></th>
			<th><span>{$val.bname}</span></th>
			<th><span>{$val.bnum}</span></th>
			<th><span>{$val['btime']|date='Y.m.d',###}</span></th>
			<th>
				<span class="link-group">
					<a href="{:url('Brand/update')}?bid={$val.bid}">编辑</a>
					<a href="javascript:;" class="del" onclick="del(this,{$val.bid})">删除</a>
				</span>
			</th>
		</tr>
		{/foreach}
	</table>
	<div class="pull-right">
			</div>
</div>
			</div>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
	function sear(){
		var bname=$('#bname').val();
			$.ajax({
	        url: "{:url('Brand/index')}",
	        data:{'bname':bname},
	        type: "post",
	        dataType: "json",
	        success: function (me) {
	        }
    	});
	}
	function del(obj,bid){
		if(!confirm('确定删除吗')){
			return false;
		}
		$.ajax({
	        url: "{:url('Brand/del')}",
	        data:{'bid':bid},
	        type: "post",
	        dataType: "json",
	        success: function (mega) {
	          if(mega==1){
	           		obj.parentNode.parentNode.parentNode.remove();
	           }else{
	           		util.message('删除失败', '', '');
	           }
	        }
    	});
	}
</script>
{include file="public/footer" /}